package com.example.demo_mysql_mybatisplus.util.controller.advicer;

import com.example.demo_mysql_mybatisplus.mybatisplus.entitys.User;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("controller/advicer")
public class AdvicerExController {

    @GetMapping("demo_1")
    public Object demo_1() {// 正常
        return new User();
    }

    @GetMapping("demo_2")
    public Object demo_2() {// 未知异常
        return 1/0;
    }

    @GetMapping("demo_3")
    public void demo_3() {
        ErrorEnum.PARAM_ERROR.throwEx();
    }

    @GetMapping("demo_4")
    public void demo_4() {
        ErrorEnum.NO_PERMISSION.throwEx("no edit permission");
    }

    @GetMapping("demo_5")
    public void demo_5() {
        ErrorEnum.API_RETURN_ERROR.throwEx(999,"desc of api" );
    }

}